//
//  Login.swift
//  
//
//  Created by Jiang Chencheng on 2024/8/30.
//

import Fluent
import Vapor

struct LoginReq: Content {
    var email: String
    var password: String
}

extension LoginReq: Validatable {
    static func validations(_ validations: inout Validations) {
        // Validations go here.
        validations.add("email", as: String.self, is: .email, customFailureDescription: "请输入正确的邮箱")
        validations.add("password", as: String.self, is: .count(6..<12), customFailureDescription: "请输入正确的密码")
    }
}

struct RegisterReq: Content {
    var email: String
    var password: String
}


struct UserTokenResp: Content {
    var user: UserDTO
    var token: String
}


